<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    {% if userData %}
    <h1>编辑</h1>
    <form method="post" aciton="/update/user">
      {% csrf_token %}
      <input type="text" name="user" placeholder="用户名" value="{{userData.name}}"/>
      <input type="password" name="pwd" placeholder="密码" value="{{userData.password}}"/>
      <input type="number" name="age" placeholder="年龄" value="{{userData.age}}"/>
      <input style="visibility: hidden" type="number" name="id"  value="{{userData.id}}"/>
      <input type="submit" value="提交" />
    </form>
    {% else %}
    <h1>注册</h1>
    <form method="post" aciton="/register/">
      {% csrf_token %}
      <input type="text" name="user" placeholder="用户名" />
      <input type="password" name="pwd" placeholder="密码" />
      <input type="number" name="age" placeholder="年龄" />
      <input type="submit" value="提交" /><span style="color: red"
        >{{error_msg}}</span
      >
    </form>
    {% endif %}
  </body>
</html>
